Skip to content

Fix multiple reported issues#10965

Open
kareem-wolfssl wants to merge 5 commits into
wolfSSL:masterfrom
kareem-wolfssl:zd22133
Open

Fix multiple reported issues#10965
kareem-wolfssl wants to merge 5 commits into
wolfSSL:masterfrom
kareem-wolfssl:zd22133

Conversation

@kareem-wolfssl

Copy link
Copy Markdown
Contributor

Description

Fixes zd#22133

Testing

Built in tests, provided reproducers

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@kareem-wolfssl kareem-wolfssl self-assigned this Jul 22, 2026
Copilot AI review requested due to automatic review settings July 22, 2026 01:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses multiple reported issues (zd#22133) by tightening memory-management around X509 decoding and improving safety in shared-context initialization and key allocation logic.

Changes:

  • Prevent orphaned allocations when re-decoding certificates into existing WOLFSSL_X509 objects.
  • Add CTX-level locking around lazy ctx->suites initialization to avoid races/leaks in multi-threaded wolfSSL_new() usage.
  • Zero newly allocated key structures in AllocKey() to make partial-init failure paths safe to free.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/ssl.c Frees existing X509 contents before reinitializing/decoding to avoid orphaned allocations.
src/internal.c Guards lazy ctx->suites init with CTX mutex and zeroes AllocKey() allocations pre-init.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ssl.c Outdated
Comment thread src/internal.c

@PhilipTaronQ PhilipTaronQ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me.

@kareem-wolfssl

Copy link
Copy Markdown
Contributor Author

Retest this please

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐺 Skoll Code Review

Overall recommendation: APPROVE
Findings: 3 total — 1 posted, 2 skipped

Posted findings

  • [Medium] suites race fix not applied to the parallel lazy-alloc path in wolfSSL_set_SSL_CTXsrc/internal.c:8274-8299
Skipped findings
  • [Medium] No regression test added for the concurrent suites-init and peerCert re-decode fixes
  • [Low] Redundant FreeX509/InitX509 in wolfSSL_get_peer_certificate now that DecodeToX509 frees internally

Review generated by Skoll via Claude/Codex

Comment thread src/internal.c
@PhilipTaronQ

Copy link
Copy Markdown

@qcwallace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants